package work1.work4;

import java.util.Scanner;

public class index {

    /**
     * @Author admin
     * @Date 2019/3/27 9:18
     */

        public static void main(String[] args) {
            Scanner in = new Scanner(System.in);
            String maxString="woaijavawozhenaijavawozhendeaijavawozhendehenaijava";
            String minString="java";
            System.out.println("java在大串中出现的次数"+getcount(maxString,minString));

        }
        public static int getcount(String max,String min){
            int count=0;
            int index = max.indexOf(min);
            while (index!=-1){
                count++;
                max = max.substring(index+min.length());
                index=max.indexOf(min);
            }
            return count;
        }
    }

